package Panels;

import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import Code.TablePanelInfo;


public class Table extends JPanel{

	private String QueryLocation=null;
	private String TableName;
	
	public Table(String Name,boolean Query){
		TableName=Name;
		if(Query){
			switch(Name){
				case"Create Tables":
					QueryLocation="./SQLCommandFiles/CreateTables";
				break;
				case"Drop All Tables":
					QueryLocation="./SQLCommandFiles/DropTables";
				break;
				case"Everything":
					QueryLocation="./SQLCommandFiles/TestMysqlCommands";
				break;
			
			}
		}
		Create();
	}
	
	
	public void Create(){
		TablePanelInfo TPInfo=new TablePanelInfo(QueryLocation);
		TPInfo.TableName=TableName;
		setLayout(new BorderLayout());
		JSplitPane SplitPane=new JSplitPane(JSplitPane.VERTICAL_SPLIT,new SQLQuery(TPInfo),new Results(TPInfo));
		SplitPane.setOneTouchExpandable(false);
		SplitPane.setDividerLocation(150);
		add(SplitPane);
	}
	
	
}
